<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:replace="dashboard/header :: header"></head>
<body>
	<div layout:fragment="content">
		
		<div class="container-fluid">
            <div class="row">
               
                <div class="col-lg-12" >
                  <div class="col-sm-12 search-collapse">
						<form id="operlog-form">
							<div class="select-list">
								<ul>
									<li>
										<label>所属应用 </label> 
										<input id="text-input" type="text" onclick="showApplication()" name="applicationIdLabel" readonly="readonly" style="cursor: pointer" placeholder="所属应用">
										<input type="hidden" id="applicationId" name="condition[applicationId]"  />
									</li>
									<li>
										<label>名称： </label><input type="text" name="condition[codeName|like]"/>
									</li>
									<li>
										<label>代码值： </label><input type="text" name="condition[codeValue|like]"/>
									</li>
									<li>
										<label>状态： </label><input type="text" name="condition[hasStatus]"/>
									</li>
									<li>
										<a class="btn btn-primary btn-rounded btn-sm" onclick="searchPre()"><i class="fa fa-search"></i>&nbsp;搜索</a>
										<a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
									</li>
								</ul>
							</div>
						</form>
					</div>
					
					<div class="btn-group-sm" id="toolbar" role="group">
						<a class="btn btn-success" onclick="$.operate.add()">
							<i class="fa fa-plus"></i> 新增
						</a>
						<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()">
				            <i class="far fa-trash-alt"></i> 删除
				        </a>
				        <!-- 
				        <a class="btn btn-danger" onclick="$.operate.clean()">
			                <i class="fa fa-trash"></i> 清空
			            </a>
				         -->
			            <a class="btn btn-warning" onclick="$.table.exportExcel()">
							<i class="fa fa-download"></i> 导出
						</a>
						<a class="btn btn-success" onclick="addType()">
							<i class="fa fa-plus"></i> 新增分类
				        </a>
			            <a class="btn btn-warning" onclick="managerType()">
				            <i class="fa fa-download"></i> 管理分类 
				        </a>
			        </div>
			        
					<div class="col-sm-12 select-table table-striped">
						<table id="bootstrap-table" data-mobile-responsive="true"></table>
					</div>
                </div>
                
              <!-- /.col-->
            </div>
            <!-- /.row-->
        </div>

		
	</div>

	<footer th:replace="dashboard/footer :: footer"></footer>
	
	 <script>
		var detailFlag = "";
		var prefix = ctx + "monitor/operlog";
		var tableType ; 

		$(function() {
		    
		    var options = {
			        url: ctx+"portal/ucenter/dictionary/datatables" ,
			        createUrl: ctx + 'portal/ucenter/dictionary/add' ,
			        updateUrl: ctx+"portal/ucenter/dictionary/modify?id={id}" ,
			        detailUrl: ctx+"portal/ucenter/dictionary/detail?id={id}",
			        removeUrl: ctx+"portal/ucenter/dictionary/delete" ,
			        statusUrl: ctx+"portal/ucenter/dictionary/changeStatus?id={id}" , 
			        exportUrl: ctx + "portal/ucenter/dictionary/exportExcel",
			        sortName: "operTime",
			        uniqueId:"id" ,
			        sortOrder: "desc",
			        modalName: "字典",
			        escape: true,
			        showPageGo: true,
			        rememberSelected: true,
			        columns: [{field: 'state',checkbox: true },
			        	
				        {field: 'applicationIdLabel', title: '所属应用'},
				        {field: 'codeTypeValueLabel', title: '代码类型'},
				        {field: 'codeName', title: '代码名称'} ,
				        {field: 'codeValue', title: '代码值'} ,
				        {field: 'hasStatusLabel', title: '状态', align: 'center',  formatter:function(value,row,index){ return $.table.status(value , row);}},
				        {field: 'id' , title: '操作',  align: 'center',  formatter: function(value, row, index) {
				                var actions = [];
				                
				                actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
				                actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="far fa-trash-alt"></i>删除</a> ');
				                
				                return actions.join('');
				          }
				     }]
			    };
			    $.table.init(options);
		});
	
		// 添加分类
		function addType(){
			var addTypeUrl = ctx+"portal/ucenter/dictionaryType/add" ; 
			$.modal.open("添加字典分类",addTypeUrl);	
		}
	
		// 分类管理 
		function managerType(){
			var addTypeUrl = ctx+"portal/ucenter/dictionaryType/list" ; 
			$.modal.open("管理字典分类",addTypeUrl);	
		}
		
	</script>

</body>
</html>
